﻿@{
    ViewBag.Title = "Done";
    ViewBag.First = "个人办公";
    ViewBag.Second = "我的已办";
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
}
<script src="~/Content/laypage-v1.3/laypage/laypage.js"></script>
<script src="~/Content/layer-v2.1/layer/extend/layer.ext.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        loadData(1, 1);
    });
    //数据加载
    function loadData(curr, tag) {
        var url = '@Url.Action("GetDoneData")';
        var load = loadTip("数据加载中，请稍候", 16, 0);
        $.get(url, { pageSize: 10, pageIndex: curr }, function (data) {
            $("#listData").find("tr").remove();
            if (tag == 1) {
                initPage(data.PageCount, 1);
                $("#recordCount").html(data.RecordCount);
            }
            var table = document.getElementById("listData");
            $.each(data.Data, function (index, n) {
                var row = table.insertRow(table.rows.length);
                var cbx = row.insertCell(0);
                cbx.innerHTML = (index + 1);
                var title = row.insertCell(1);
                var urlUserCarInfo = '@Url.Action("UseCarInfo2")' + "?sid=" + n.Source + "&todo=" + n.Id;
                title.innerHTML = "<a href='"+urlUserCarInfo+"'>"+n.Name;
                var time = row.insertCell(2);
                time.innerHTML = ChangeDateFormat(n.CreateTime, 1);
            });
            $('.tablelist tbody tr:odd').addClass('odd');
            $("#currPage").html(curr);
            layer.close(load);
        });
    }
    //初始化分页
    function initPage(pageCount, curr) {
        laypage({
            cont: 'paginList',
            pages: pageCount,
            first: false,
            last: false,
            skip: true,
            curr: curr || 1,
            jump: function (e, first) {
                if (!first) {
                    loadData(e.curr)
                }
            }
        });
    }
</script>
<div id="content" class="rightinfo">
    <table class="tablelist">
        <thead>
            <tr>
                <th width="40px">编号</th>
                <th>标题</th>
                <th width="160">创建时间</th>
            </tr>
        </thead>
        <tbody id="listData"></tbody>
    </table>
    <div class="pagin">
        <div class="message" style="padding-top:5px;">共&nbsp;<i class="blue" id="recordCount"></i>&nbsp;条记录，当前显示第&nbsp;<i class="blue" id="currPage"></i>&nbsp;页</div>
        <ul class="paginList" id="paginList"></ul>
    </div>
</div>
